package com.jwgf.common;

import android.widget.Toast;

public class GlobalToast {
    private static GlobalToast instance;

    private static Toast toast;

    private GlobalToast() {
    }

    public static GlobalToast getInstance() {
        if (instance == null) {
            instance = new GlobalToast();
        }
        return instance;
    }

    public void show(String text) {
        if (toast != null) {
            toast.setText(text);
            toast.setDuration(2000);
            toast.show();
        } else {
            toast = Toast.makeText(AppContext.getInstance(), text, 2000);
            toast.show();
        }
    }
}
